package com.wy.panda.controller.po;

import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.wy.panda.constant.UserTypeEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * 用户控制层领域模型
 * @author wangyuan
 * @since 2021-03-27 13:27:02
 */
@ApiModel("用户")
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SysUserPO extends BasePO {

    private static final long serialVersionUID = 95788216382458144L;
    
    @ApiModelProperty("主键")
    @NotNull(groups = {UpdateGroup.class}, message = "ID不能为空")
    private Long id;
    
    @ApiModelProperty("用户名")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "用户名不能为空")
    @Length(groups = {CreateGroup.class, UpdateGroup.class}, max = 100, message = "用户名长度需要在{min}和{max}之间")
    private String username;
    
    @ApiModelProperty("密码")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "密码不能为空")
    @Length(groups = {CreateGroup.class, UpdateGroup.class}, max = 10, message = "密码长度需要在{min}和{max}之间")
    private String password;
    
    @ApiModelProperty("用户类型：0，系统管理员")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "用户类型不能为空")
    private UserTypeEnum userType;
    
    @ApiModelProperty("账号是否锁定：0否，1是")
    private Integer isLocked;
    
    @ApiModelProperty("账号是否过期：0否，1是")
    private Integer isExpired;
    
    @ApiModelProperty("账号状态：0禁用，1启用")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "账号状态不能为空")
    private Integer isEnabled;
    
    @ApiModelProperty("备注")
    @Length(groups = {CreateGroup.class, UpdateGroup.class}, max = 500, message = "密码长度需要在{min}和{max}之间")
    private String remark;
    
}